#!/bin/sh

#使用方法：


GIT_HOME=/developer/git-repository/SellingSystem_fe
DEST_PATH=/product/frontend

echo -e "==============enter git-home=============="
cd $GIT_HOME

echo -e "==============clear git-dist=============="
rm -rf ./dist

echo -e "==============checkout master=============="
git checkout master

echo -e "==============git pull=============="
git pull

echo -e "==============npm install=============="
npm install --registry https://registry.npm.taobao.org

echo -e "==============npm run dist=============="
npm run dist

if [ -d "./dist" ] then
	# echo -e "==============dist backup=============="
	# mv $DEST_PATH/dist $DEST_PATH/dist.bak

	echo -e "==============deploy success=============="
	cp -R ./dist $DEST_PATH
else
	echo -e "==============deploy error=============="
fi